//--------------------------------------------------- // Purpose: Demonstrate input/output of text. // Author: John Gauch //--------------------------------------------------- #include using namespace std; int main() { // Read and write text one word at a time cout << "Enter your message followed by a period on a separate line" << endl; string input1 = ""; cin >> input1; while (input1 != ".") { cout << "'" << input1 << "'" << endl; cin >> input1; } // Read and write text one line at a time cout << "Enter your message followed by a period on a separate line" << endl; string input2 = ""; getline(cin,input2); while (input2 != ".") { cout << "'" << input2 << "'" << endl; getline(cin,input2); } // Read and write text one character at a time cout << "Enter your message followed by a period on a separate line" << endl; char input3 = ' '; cin >> input3; while (input3 != '.') { cout << "'" << input3 << "'" << endl; cin >> input3; } // Read and write text one character at a time cout << "Enter your message followed by a period on a separate line" << endl; char input4 = ' '; cin.get(input4); while (input4 != '.') { cout << "'" << input4 << "'" << endl; cin.get(input4); } return 0; }